package com.yl.auth.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yl.auth.model.vo.ChenlianVo;
import com.yl.auth.service.ChenlianService;
import com.yl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ln
 * @since 2023-06-20
 */
@RestController
@RequestMapping("/admin/chenlian")
@Api(tags = "养老护理-老人晨练")
public class ChenlianController {
    @Resource
    private ChenlianService chenlianService;

    @GetMapping("/getchenlian/{page}/{limit}")
    @ApiOperation(value = "获取全部老人晨练信息")
    public Result getchenlian(@PathVariable @ApiParam("当前页") Integer page, @PathVariable @ApiParam("总条数") Integer limit, @ApiParam("老人姓名") String lrname,  @ApiParam("上报时间") String sbtime){
        Page<ChenlianVo> iPage = new Page<>(page,limit);
        Page<ChenlianVo> pageVo = chenlianService.getchenlian(iPage, lrname, sbtime);
        return Result.ok(pageVo);
    }
    @GetMapping("/getchenlianById/{id}")
    @ApiOperation(value = "根据Id回显")
    public Result getchenlianById(@PathVariable @ApiParam("晨练id") Integer id){
        ChenlianVo chenlianVo = chenlianService.getchenlianById(id);
        return Result.ok(chenlianVo);
    }

}

